package xyhoo.springframework.beans.factory.xml;

import xyhoo.springframework.beans.factory.parsing.ProblemReporter;
import xyhoo.springframework.beans.factory.parsing.ReaderContext;
import xyhoo.springframework.beans.factory.parsing.ReaderEventListener;
import xyhoo.springframework.beans.factory.parsing.SourceExtractor;
import xyhoo.springframework.beans.factory.support.BeanDefinitionRegistry;
import xyhoo.springframework.core.env.Environment;
import xyhoo.springframework.core.io.Resource;

public class XmlReaderContext extends ReaderContext {

    private final XmlBeanDefinitionReader reader;

    private final NamespaceHandlerResolver namespaceHandlerResolver;

    public XmlReaderContext(
            Resource resource, ProblemReporter problemReporter,
            ReaderEventListener eventListener, SourceExtractor sourceExtractor,
            XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver) {

        super(resource, problemReporter, eventListener, sourceExtractor);
        this.reader = reader;
        this.namespaceHandlerResolver = namespaceHandlerResolver;
    }

    public final Environment getEnvironment() {
        return this.reader.getEnvironment();
    }

    public final NamespaceHandlerResolver getNamespaceHandlerResolver() {
        return this.namespaceHandlerResolver;
    }

    public final XmlBeanDefinitionReader getReader() {
        return this.reader;
    }

    public final BeanDefinitionRegistry getRegistry() {
        return this.reader.getRegistry();
    }

    public final ClassLoader getBeanClassLoader() {
        return this.reader.getBeanClassLoader();
    }
}
